home *** CD-ROM | disk | FTP | other *** search
/ Amiga Plus 2004 #2 / Amiga Plus CD - 2004 - No. 02.iso / AmigaPlus / Tools / Development / RxMUI / Examples / Hvb.rexx < prev    next >
Encoding:
OS/2 REXX Batch file  |  2004-01-31  |  4.1 KB  |  147 lines

  1. /* HTMLview exampe
  2.  *
  3.  * DemoHTMLview 1.0 (18.11.0)
  4.  * HTML File Viewer
  5.  * © 2000 by Robert A. Sisk
  6.  *
  7.  */
  8.  
  9. signal on Error
  10. signal on Halt
  11.  
  12. call AddLib "rmh.library",0,-30
  13. if AddLibrary("rexxsupport.library","rxmui.library")~=0 then do
  14.     call EasyRequest "Couldn't open" result,app,"Quit"
  15.     exit
  16. end
  17.  
  18. appPath = ProgramName("FULL")
  19. if RMH_AskToolType(appPath,"DebugRxMUI","key") then call RxMUIOpt "DebugMode ShowErr"
  20. sb = upper(RMH_AskToolType(appPath,"ScrollBars"))
  21.  
  22. App.Author="Robert A. Sisk"
  23. App.Base="DEMOHTMLVIEW"
  24. App.Copyright="© 2000 by Robert A. Sisk"
  25. App.Description="HTML File Viewer."
  26. App.SubWindow="mwin"
  27. App.SingleTask=1
  28. App.Title="$VER: DemoHTMLview 1.0 (18.11.0)"
  29. App.Version="DemoHTMLview"
  30.  mwin.Contents="mgroup"
  31.  mwin.ID="MAIN"
  32.  mwin.Title="DemoHTMLview"
  33.  mwin.AppWindow=1
  34.  
  35.   call child "mgroup","vg","group"
  36.    vg.Spacing=0
  37.     call child "vg","hg","group"
  38.      hg.Horiz=1
  39.      hg.Spacing=0
  40.       call child "hg","html","HTMLview"
  41.        html.Frame="Virtual"
  42.        html.NTAutoLoad=1
  43.       call child "hg","sbv","scrollbar"
  44.        sbv.ShowMe=0
  45.     call child "vg","sbh","scrollbar"
  46.      sbh.Horiz=1
  47.      sbh.ShowMe=0
  48.   call child "mgroup","gauge","gauge"
  49.    gauge.horiz=1
  50.    gauge.FixHeightTxt="n"
  51.    gauge.InfoText="Drop a HTML file over me!"
  52.   call child "mgroup",MakeObj(,"scale")
  53.  
  54. call NewObj "Application","App"
  55. if result~=0 then call RxMUIError result
  56.  
  57. call Notify "mwin","CloseRequest",1,"App","ReturnID","Quit"
  58. call Notify "html","ClickedURL","EveryTime","App","Return","call GoToURL(h.clickedURL)","TriggerAttr"
  59.  
  60. call Notify "html","height","EveryTime","App","Return","call SetScrollBars()"
  61. call Notify "html","width","EveryTime","App","Return","call SetScrollBars()"
  62. call Notify "html","parsed","EveryTime","App","Return","call parsed(h.parsed)","triggerattr"
  63.  
  64. call Notify "html","title","everytime","gauge","set","infotext","triggervalue"
  65.  
  66. call Notify "html","virtgroupwidth","everytime","sbh","set","entries","triggervalue"
  67. call Notify "html","virtgroupleft","everytime","sbh","set","first","triggervalue"
  68. call Notify "html","virtgroupheight","everytime","sbv","set","entries","triggervalue"
  69. call Notify "html","virtgrouptop","everytime","sbv","set","first","triggervalue"
  70. call Notify "html","width","everytime","sbh","set","visible","triggervalue"
  71. call Notify "html","height","everytime","sbv","nonotifyset","visible","triggervalue"
  72. call Notify "sbh","first","everytime","html","set","virtgroupleft","triggervalue"
  73. call Notify "sbv","first","everytime","html","set","virtgrouptop","triggervalue"
  74.  
  75. call AppMessage "mwin"
  76.  
  77. call set "mwin","Open",1
  78.  
  79. ctrl_c=2**12
  80. do forever
  81.     call NewHandle "App","h",ctrl_c
  82.     if RMH_And(h.signals,ctrl_c)>0 then exit
  83.     if h.EventFlag then
  84.         select
  85.             when h.event="QUIT" then exit
  86.             when h.event=="SetScrollBars" then call SetScrollBars
  87.             when h.event=="APPEVENT" then call appevent(h.name)
  88.             otherwise interpret h.event
  89.         end
  90. end
  91.  
  92. AppEvent:
  93. parse arg file
  94.     projectFile=file
  95.     st=StateF(projectFile)
  96.     if word(st,1)~=="FILE" then return 0
  97.     total=word(st,2)
  98.     call set("gauge","max",total)
  99.     call set("gauge","current",0)
  100.     call GoToURL "file://"projectFile
  101.     return
  102.  
  103. GoToURL:
  104.     call DoMethod "html","GoURL",arg(1)
  105.     return 1
  106.  
  107. RxMUIError:
  108.     if symbol("RxMUIError")=="LIT" then RxMUIError="?"
  109.     say app": Line" SigL", RxMUI" RxMUIError "error" arg(1)":" GetRxMUIString(arg(1))
  110.     exit
  111.  
  112. Halt:
  113.     exit
  114.  
  115. SetScrollBars:
  116.     select
  117.         when sb="NO" then return
  118.         when sb="YES" then do
  119.             rh=0
  120.             vh=1
  121.             rw=0
  122.             vw=1
  123.         end
  124.         when sb="HORIZAUTO" then do
  125.             rh=0
  126.             vh=1
  127.             call getattr("html","width","rw")
  128.             call getattr("html","virtgroupwidth","vw")
  129.         end
  130.         otherwise do
  131.             call getattr("html","width","rw")
  132.             call getattr("html","virtgroupwidth","vw")
  133.             call getattr("html","height","rh")
  134.             call getattr("html","virtgroupheight","vh")
  135.         end
  136.     end
  137.     call set("sbv","showme",rh<vh)
  138.     call set("sbh","showme",rw<vw)
  139.     return
  140.  
  141. parsed:
  142. parse arg p
  143.     if p=total then call SetScrollBars
  144.     call set("gauge","current",p)
  145.     return
  146.  
  147.